// 字面量

let z: 521 = 521;

let name:"张三" = "张三"

console.log(name, z);

// void 类型  一般限制返回值为undefined
function fn(a: number): void {
    return undefined
}

// 数组
let a: number[] = [1, 2, 3, 4]


let b: Array<string> = ["1", "2", "3"]
console.log(a,b);

// 元组  固定长度和类型的数组
let c:[string,number] = ["123",123]
console.log(c);

// 枚举

enum Gender {
    nan = "男",
    nv="女"
}

let me: object = {
    name: "li",
    gender:Gender.nan
}
console.log(me);

// 联合类型   取值可以为多种类型中的一种
let v1: number | string;
v1 = "123";
v1 = 123
console.log(v1);

// 类型断言

(async () => {
    let v: number | string;
    v = await new Promise((resolve) => {
        resolve(3.145);
    });

  console.log( ( v as number).toFixed(2));


    // //方式一  as
    // console.log((v as number).toFixed(2));
    // //方式二  <类型>
    // console.log((<number>v).toFixed(2));
  })()




// 暴露一个空对象  防止重名元素
export { }